package com.seadragon.apps.doctorcard.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.vividsolutions.jts.geom.Point;

@Entity
@Table(name = "chat_contact")
public class ChatContact {
	@Id
	@Column(name = "ID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;

	@ManyToOne
	@JoinColumn(name="CHAT_ID")
	private Chat chat;

	@ManyToOne
	@JoinColumn(name="CONTACT_ID")
	private Contact contact;

	@Column(name = "LOCATION")
    @Type(type = "org.hibernate.spatial.GeometryType")
    private Point location;

	@Column(name="IS_OWNER")
	private boolean isOwner;
	
	@Column(name="DATE_JOINED")
	private Date dateJoined;

	public ChatContact(){}
	
	public ChatContact(Chat chat, Contact contact){
		this.chat = chat;
		this.contact = contact;
	}
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Chat getChat() {
		return chat;
	}

	public void setChat(Chat chat) {
		this.chat = chat;
	}

	public Contact getContact() {
		return contact;
	}

	public void setContact(Contact contact) {
		this.contact = contact;
	}

	public boolean isOwner() {
		return isOwner;
	}

	public void setOwner(boolean isOwner) {
		this.isOwner = isOwner;
	}

	public Date getDateJoined() {
		return dateJoined;
	}

	public void setDateJoined(Date dateJoined) {
		this.dateJoined = dateJoined;
	}

	public Point getLocation() {
		return location;
	}

	public void setLocation(Point location) {
		this.location = location;
	}

}
